<?php
/**
 *	Architect Framework
 *
 *	Architect Framework is a light weight object oriented web applications framework written for PHP 5.1.4 and later that provide the tools to develop and deploy a website or application fast and with as little code as possible.
 *
 *	@author Robin Grass, <hello@coffinboy.se>
 *	@link http://architect.kodlabbet.net
 *	@license http://www.opensource.org/licenses/gpl-3.0.html GNU General Public License (v. 3)
 */

/**
 *	Architect_FrameworkLocator
 *
 *	Architect_FrameworkLocator is a generic locator service class.
 *
 *	@package Custom libraries
 *	@version 1.0
 *	@author Robin Grass, <hello@coffinboy.se>
 */
class Architect_FrameworkLocator implements Architect_Locator {

	/**
	 *	@var string $path
	 */
	protected $path;
	
	/**
	 *	__construct
	 *
	 *	@param string $directory
	 */
	public function __construct($directory) {
		$this->path = (string) $directory;
	}
	
	/**
	 *	getPath
	 *
	 *	This method returns a Architect_ClassDirectoryLocator object.
	 *
	 *	@param string $class
	 *
	 *	@return object
	 */
	public function getPath($class) {
		return new Architect_ClassDirectoryLocator($class, $this->path) . strtolower($class) . ARCH_FILE_EXT;
	}
	
	/**
	 *	canLocate
	 *
	 *	This method checks if a class file exists.
	 *
	 *	@param string $class
	 *
	 *	@return bool
	 */
	public function canLocate($class) {
		if(file_exists($this->getPath($class)))
			return true;
	return false;
	}

}
?>